<%@ page contentType="text/html; charset=UTF-8" language="java"%>
<%@ include file="/taglibs.jsp"%>
<head>
<meta name="decorator" content="blank">
<script type="text/javascript" src="${ctx}/scripts/jqueryvalidate/jquery.validate.js"></script>
<%@ include file="/WEB-INF/jsps/includes/jqueryui.jsp"%>

</head>
<body>
<div id="signinwrap" class="zui-portlet-signinwrap ui-tabs ui-widget ui-widget-content ui-corner-all ">		
	<span class="ui-helper-clearfix ui-widget-header ui-corner-all zui-portlet-header">Sign In</span>

	<c:if test="${not empty param.login_error}">
       <div class="ui-widget" style="padding: 10px 0px">
           <div class="ui-state-error ui-corner-all" style="padding: 0 .7em;"> 
               <p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span> 
               <s:text name="error.login"></s:text></p>
           </div>
       </div>
    </c:if>
    
	<form id="signinform" action="j_spring_security_check" method="POST" autocomplete="off" >
	<div class="row">
		<span class="label"><label id="lemail" for="email"><s:text name="username" /></label></span>
		<span class="field"><input type="text" id ="email" name="j_username" class="text ui-widget-content ui-corner-all"/></span>
		<span class="status"></span>
	</div>
	<div class="row">
		<span class="label"><label id="lpassword" for="password"><s:text name="password"/></label></span>
		<span class="field"><input type="password" id ="password" name="j_password" class="text ui-widget-content ui-corner-all"/></span>
		<span class="status"></span>
	</div>
	<div class="row">
		<span class="label">&nbsp;</span><span class="field"><s:submit id="submit" key="button.submit" /></span>
	</div>
	<div class="spacer"></div>
	</form>
</div>

<script type="text/javascript">
$(function() {
	$( "#submit" ).button();
});
document.all.j_username.focus();
$(document).ready(function() { 
    // validate signup form on keyup and submit 
    var validator = $("#signinform").validate({ 
        debug: false,
        rules: { 
		    'j_username': { 
		        required: true
		        //email: true//, 
		        //remote: "emails.php" 
		    },
            'j_password': { 
                required: true, 
                minlength: 3 
            }
        }, 
        messages: {
        	'j_username': { 
	            required: '<s:text name="password"/>'
	        }, 
	        'person.password': { 
                required: "Provide a password", 
                rangelength: jQuery.format("Enter at least {0} characters") 
            } 
        }, 
        // the errorPlacement has to take the table layout into account 
        errorPlacement: function(error, element) { 
            if ( element.is(":radio") ) 
                error.appendTo( element.parent().next().next() ); 
            else if ( element.is(":checkbox") ) 
                error.appendTo ( element.parent().next() ); 
            else {
                error.appendTo( element.parent().next() );
            } 
        }, 
        // specifying a submitHandler prevents the default submit, good for the demo 
        submitHandler: function(form) { 
            form.action = "${ctx}/j_spring_security_check";
			form.submit(); 
        }, 
        // set this class to error-labels to indicate valid fields 
        success: function(label) { 
            // set   as text for IE 
            label.html(" ").addClass("checked"); 
        } 
    });
}); 
</script>
</body>
